Deploy Table Schema
๐ <ENV> - [BigQuery] Deploy table schema
โ
This GitHub Actions workflow is designed to manually deploy or update BigQuery table schemas based on a JSON schema file. It uses bq
CLI commands to apply the schema to both the _latest
and _changelog
versions of a BigQuery table.
๐ Workflow Triggerโ
This workflow is triggered manually from github actions in functions repo
Required Input:โ
schema_name
(string): The base name of the schema (without suffixes like_latest
or_changelog
).
๐ Environment Variablesโ
Variable | Description |
---|---|
GCP_PROJECT_ID | GCP Project ID (e.g., biddirect-2 ) |
๐ Job: update-bigquery-table-schema
โ
Step | Description |
---|---|
Checkout repository | Clones the repo. |
Authenticate with GCP | Authenticates using a service account (ENV_BIGQUERY_ADMIN_SERVICE_ACCOUNT ) stored in GitHub Secrets. |
Set up Cloud SDK | Installs and sets up the Google Cloud SDK CLI. |
Install dependencies | Installs Node.js dependencies from the functions directory. |
Update _latest schema | Runs bq update to apply the schema to the *_latest table. |
Update _changelog schema | Runs bq update to apply the schema to the *_changelog table. |
๐งน Schema File Locationโ
Schema JSON files should be placed under:
functions/src/bqDataLake/definitions/tableSchemas/
Each file should follow the naming convention:
<schema_name>.json
Example:
functions/src/bqDataLake/definitions/tableSchemas/accounts.json
๐ Required Secretsโ
Secret Name | Description |
---|---|
<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT | Service account key JSON for GCP auth. |
โ Example Usageโ
To run this workflow:
- Go to the Actions tab in your GitHub repository.
- Select the workflow
<ENV> - [BigQuery] Deploy table schema
. - Enter the
schema_name
(e.g.,accounts
oraccounts_serviceUnit
). - Click "Run workflow".
This will update the following BigQuery tables in bqDataLake
:
<schema_name>_latest
<schema_name>_changelog
Both tables will be updated with the new schema definition.